<?php
/**
 * Created by PhpStorm.
 * User: xlosy
 * Date: 2018/3/24
 * Time: 20:49
 */

namespace app\index\model;


use think\Model;

class Catalog extends Model
{

    //自定义初始化
    protected function initialize()
    {
       //需要调用`Model`的`initialize`方法
      parent::initialize();
       //TODO:自定义的初始化
    }


    /**
     * 查询所有一级目录菜单
     * @return false|static[]
     * @throws \think\exception\DbException
     */
    public function get_cata_log_list(){
        // 使用数组查询
       $catalog = new Catalog();
       $uid = session('uid');
       $adminUId = session('AdminUId');
       $condition = ['isUse' => '1'];
       if($adminUId==null){
           if($uid == null){
               $condition['isVip'] = "0";
           }else{
               $condition['isVip'] = "1";
           }
       }
       $rtn =  $catalog->where($condition)->order('sort', 'asc')->select();
       return $rtn;
    }
}